Ext.namespace('pages.extutils');
pages.extutils.extutil = function(config) {
	Ext.apply(this, config);
	this.initUIComponents();
	pages.extutils.extutil.superclass.constructor.call(this);
};

Ext.extend(pages.extutils.extutil, Ext.Panel, {
	initUIComponents : function() {
		var menuRoletree =  new Ext.tree.TreePanel({
			id : 'HANDLE_TREE',
			height : 100,
			rootVisible : false,
			animate : true,
			autoScroll : true,
			loader : new Ext.tree.TreeLoader({
				baseParams : {
					nodeId : '-1'
				},
				baseAttrs : {
						uiProvider : Ext.tree.TreeCheckNodeUI					
					},
				dataUrl : ExtJ.getActionPath('role/queryRoleListchecked.do')
			}),
			root : new Ext.tree.AsyncTreeNode({
				id : '-1',
				text : '根'
			}),
			listeners : {
				'beforeload' : function(node, e) {
					Ext.getCmp('HANDLE_TREE').getLoader().baseParams.nodeId = node.id;
				}.createDelegate(this)
				,'load' : function(node, e) {
					Ext.getCmp('COM_TREE_ID').setValue();
				}.createDelegate(this)
			}
		})
		this.queryForm = new Ext.form.FormPanel({
			layout : 'column',
			region : 'center',
			labelWidth : 200,
			labelAlign : 'right',
			autoHeight :true,
			border : false,
			frame : false,
			items : [{
				columnWidth :1,
				height : 10,
				border : false
			},{
				columnWidth : .5,
				layout : 'form',
				border : false,
				items : [{
					fieldLabel : '时间选择到分钟',
					name : 'HB_CREATE_DATE_START',
					id : 'HB_CREATE_DATE_START',
					anchor : '99%',
					format : 'Y-m-d h:s',
					xtype : 'datetimefield'
				}]
			},{
				columnWidth : .5,
				layout : 'form',
				border : false,
				items : [{
					  xtype: 'textfield',
			            fieldLabel: '上传文件',
			            name: 'file',
			            inputType: 'file'
				}]
			},{
                columnWidth:.3,
                layout:'form',
                items:[{
                    xtype:'fieldset',
                    checkboxToggle:true,
                    title: '多选',
                    autoHeight:true,
                    defaultType: 'checkbox',
                    hideLabels: true,
                    style: 'margin-left:10px;',
                    bodyStyle: 'margin-left:20px;',
                    items: [{
                        boxLabel: '多选一',
                        name: 'check',
                        value: '1',
                        checked: true,
                        width: 'auto'
                    },{
                        boxLabel: '多选二',
                        name: 'check',
                        value: '2',
                        checked: true,
                        width: 'auto'
                    },{
                        boxLabel: '多选三',
                        name: 'check',
                        value: '3',
                        width: 'auto'
                    }]
                }]
            },{
                columnWidth:.3,
                layout:'form',
                items:[{
                xtype:'fieldset',
                checkboxToggle:true,
                title: '单选',
                autoHeight:true,
                defaultType: 'radio',
                hideLabels: true,
                style: 'margin-left:10px;',
                bodyStyle: 'margin-left:20px;',
                items: [{
                    boxLabel: '钱',
                    name: 'rad',
                    value: '1',
                    checked: true,
                    width: 'auto'
                },{
                    boxLabel: '权',
                    name: 'rad',
                    value: '2',
                    width: 'auto'
                }]
            }]
        },{
			columnWidth : .5,
			layout : 'form',
			border : false,
			hidden : false,
			 defaultType: 'radio',
			 checkModel:'single',
			items : [new Ext.ux.ComboBoxCheckTree({
				anchor : '90%',
				fieldLabel : '权限分配',
				name : 'COM_TREE_ID',
				id : 'COM_TREE_ID',
				tree : menuRoletree,
				selectValueModel : 'all',
				 defaultType: 'radio',
				 checkModel:'single',
				listeners : {
					'expand' : function() {
						Ext.getCmp('HANDLE_TREE').getRootNode().reload();
						Ext.getCmp('HANDLE_TREE').expandAll();
					}.createDelegate(this)
				}
			}) ]
		} ,{
				columnWidth : 1,
	            layout: 'form',
	            labelAlign: 'top',
	            items: [{
	                xtype: 'htmleditor',
	                fieldLabel: '在线编辑器',
	                id: 'editor',
	                anchor: '98%',
	            }]
	        }]
		});
		
		
		this.eastPanel = this.tree = new Ext.tree.TreePanel({
					region : "east",
					title : '下拉树带复选框',
					width : 300,
					border : false,
					split : true,
					collapsible : true,
					loader : new Ext.tree.TreeLoader({
								baseParams : {
									nodeId : '-1',
									userId : ''
								},
								dataUrl : ExtJ.getActionPath('/cud/queryMenuList.do'),
							}),
					root : new Ext.tree.AsyncTreeNode({
								id : '-1',
								draggable : false,
								expanded : false,
								text : ''
							}),
					autoScroll : true,
					animate : false,
					border : false,
					enableDD : false,
					containerScroll : true,
					singleExpand : false,
					draggable : false,
					rootVisible : false,
					listeners : {
						'render' : function() {
						}.createDelegate(this),
						'beforeload' : function(node, e) {
							this.tree.getLoader().baseParams.nodeId = node.id;
						}.createDelegate(this)
					}
				});
		this.eastPanel.on('checkchange', function(node, checked) {
					this.selParent(node, checked);
					this.selChild(node, checked);
				}.createDelegate(this), this.eastPanel);
		
		Ext.apply(this, {
					layout : 'border',
					border : false,
					items : [ this.eastPanel ,this.queryForm],
					listeners : {
						'render' : this.initData.createDelegate(this)
					}
				})
		
	},
	initData : function() {
	},
	
	

});